// 事件总线第三方库
import mitt from 'mitt'

/**
 * 自定义事件类型
 * @example
 * ```ts
 *  import mitt from 'mitt';
    type Events = {
      foo: string;
      bar?: number;
    };
    const emitter = mitt<Events>(); // inferred as Emitter<Events>
    emitter.on('foo', (e) => {}); // 'e' has inferred type 'string'
    emitter.emit('foo', 42); // Error: Argument of type 'number' is not assignable to parameter of type 'string'. (2345)
 * ```
 */
interface Events {
  [x: string | symbol]: unknown
}
const emitter = mitt<Events>()
export { emitter }
